package com.thinkgem.jeesite.modules.sys.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.thinkgem.jeesite.modules.sys.dao.SysNotifyRecordMapper;
import com.thinkgem.jeesite.modules.sys.entity.SysNotifyRecord;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author:Kongxiangsheng
 * @DesCription:
 * @Date:Created in 12:00 2018/8/28
 * @Modified By:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysNotifyRecordService extends ServiceImpl<SysNotifyRecordMapper, SysNotifyRecord> implements IService<SysNotifyRecord> {

    /**
     * 根据父表主键查询
     *
     * @param sysNotifyId
     * @return
     */
    public List<SysNotifyRecord> getBySysNotifyId(String sysNotifyId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(SysNotifyRecord.COL_SYS_NOTIFY_ID, sysNotifyId);
        return this.list(queryWrapper);
    }

    /**
     * 根据父表主键删除
     *
     * @param sysNotifyId
     * @return
     */
    public boolean deleteBySysNotifyId(String sysNotifyId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(SysNotifyRecord.COL_SYS_NOTIFY_ID, sysNotifyId);
        return this.remove(queryWrapper);
    }
}
